# !/usr/bin python3
# encoding: utf-8 -*-
# @file     : upload_api.py
# @author   : 沙陌 Matongxue_2
# @Time     : 2024/1/18 21:44
# @Copyright: 北京码同学
import mimetypes
import os

from api.base_api import BaseBasicApi


class UploadImgApi(BaseBasicApi):

    def __init__(self,file_path):
        super().__init__()
        self.url = f'{self.host}/uploaders'
        self.method = 'post'
        # filename = os.path.basename(file_path)
        # file_type = mimetypes.guess_type(filename)[0]
        # self.files = {
        #     "file":(filename,open(file=file_path,mode='rb'),file_type),
        #     "scene":"goods"
        # }
        # 如果要在client.py里做统一封装，那么用下面的
        self.files = {
            "file":file_path,
            "scene":"goods"
        }
